package com.eshop.we.controller;

import com.baomidou.mybatisplus.plugins.Page;
import com.eshop.we.business.SchoolBusiness;
import com.eshop.we.result.Result;
import com.eshop.we.school.dto.SchoolDto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("/school")
public class SchoolController extends BaseController {

    @Autowired
    SchoolBusiness schoolBusiness;

    @GetMapping("/getschoolpage")
    public Result getSchoolPageList(@RequestParam(required = false) String schoolName,
                                    @RequestParam(required = false,defaultValue = "1")Integer pageNum,
                                    @RequestParam(required = false,defaultValue = "20")Integer pageSize){

        Page<SchoolDto> page=new Page<>(pageNum,pageSize);
        page=schoolBusiness.selectSchoolPage(page,schoolName);
        return Result.success(page);
    }

}
